import Vuex from 'vuex'
import VuexPersist from 'vuex-persist'
import Vue from 'vue'

const vuexLocal = new VuexPersist({
    storage: window.localStorage
})
Vue.use(Vuex)

export default new Vuex.Store({
    plugins: [vuexLocal.plugin],
    state: {
        token: ''
    },
    getters: {
        getToken: state => {
            return state.token
        }
    },
    mutations: {
        setToken: (state, token) => {
            state.token = token
        }
    }
})